<template>
	<view class="page-wrap" :data-theme="theme" :class="theme" :style="globalColor.style">
		<HeadCustom title="选择企业" :isAppBtn="false"></HeadCustom>
		<view class="wrap">
			<!-- <view class="title font46 font-weight color-E8CDA7">选择企业</view> -->
			<view class="tips mt16 font30 color-contentFontLightColor">你在以下企业中有招聘权限</view>
			<view v-if="list.length">
				<view class="card bg-21242C" v-for="(item, index) in list" :key="index" @click="goPage(item)">
					<view class="fboxRow Ycenter">
						<image class="logo" :src="item.companyLogo" mode="aspectFill"></image>
						<view class="flex1 font-ell1 enterprises_view">
							<view class="font32 font-ell1">{{ item.companyName }}</view>
							<text v-if="item.authStatus == 1" class="ml24 bwfont bw-qiye color-linear"></text>
						</view>
						<view class="action fboxRow Ycenter"><text class="bwfont bw-arrow-right color-ACB4C7 font28"></text></view>
					</view>
				</view>
			</view>
			<view v-if="loading == 'list-not'">
				<view class="not-card mt32 bg-21242C"><not-empty :height="300" text="暂无企业"></not-empty></view>
			</view>
		</view>
	</view>
</template>

<script>
import { companyList } from '@/api/recruit.js';
import { utf8to16, base64encode } from '@/static/js/Base64.js';
export default {
	data() {
		return {
			theme: getApp().globalData.appTheme,
						globalColor: getApp().globalData.globalColor,
			list: [],
			loading: 'loading'
		};
	},
	onLoad() {
		this.getInit();

		// const token = {
		// 	access_token: getRequest(benwu,'token'),
		// 	userId: getRequest(benwu,'userId'),
		// 	statusBarHeight: getRequest(benwu,'statusBarHeight')
		// }
		// getApp().globalData.userId = token.userId
		// getApp().globalData.statusBarHeight = token.statusBarHeight
	},
	methods: {
		goPage(e) {
			this.$pageTo('/recruit/enterprise/index?companyId=' + e.companyId);
			// const { bw_params } = getApp().getBWData(['bw_params'])
			// const obj = `token=${bw_params.access_token}&userId=${e.operatorId}&companyId=${e.companyId}&statusBarHeight=${bw_params.statusBarHeight}&authStatus=${bw_params.authStatus}`;
			// const benwu = base64encode(utf8to16(obj));
			// this.$pageTo('/recruit/enterprise/index?benwu=' + benwu);
		},
		getInit() {
			companyList({ type: 'isResume', loadingText: '加载中' }).then(res => {
				if(res.data && res.data.length){
					this.list = res.data;
				}else{
					this.loading = 'list-not'
				}
			});
		}
	}
};
</script>

<style lang="scss" scoped>
.page-wrap {
	min-height: calc(100vh);
}
.enterprises_view {
	display: flex;
	align-items: center;
}
.title {
	line-height: 66rpx;
}

.tips {
	line-height: 40rpx;
	margin-bottom: 34rpx;
}

.wrap {
	padding: 34rpx 24rpx;
}
.card {
	margin-bottom: 40rpx;
	padding: 24rpx;
	border-radius: 12rpx;
}
.logo {
	margin-right: 24rpx;
	width: 88rpx;
	height: 88rpx;
	border-radius: 12rpx;
}
.logo_rz {
	width: 40rpx;
	height: 40rpx;
	margin-left: 10rpx;
}
.not-card {
	padding-bottom: 120rpx;
}
</style>
